package com.lanchewuyou.user.driver.yancheui;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.lanchewuyou.user.driver.R;
import com.lanchewuyou.user.driver.layouts.YancheDialog;
import com.lanchewuyou.user.driver.modul.Config;

/**
 * 开始验车送车界面.
 */
public class YancheActivity extends AppCompatActivity implements View.OnClickListener {

    private Button yancheIknowBtn, yancheBeginbtn;
    private ImageButton yancheTelBtn, yancheAddBtn, yancheJianceBtn, yancheCustomBack;
    private TextView yancheOwnerName, yancheBeginType, yancheBeginAdd, yancheJianceAdd, yancheBeginTime, yancheBeginMarked;
    private static String DRIVERID;
    private YancheDialog.Builder builder;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_yanche);
        SharedPreferences sharedPreferences = getSharedPreferences(Config.PASSWORD_PATH, Activity.MODE_PRIVATE);
        DRIVERID = sharedPreferences.getString("driverid", "");
        initViews();
    }

    private void initViews() {
        yancheIknowBtn = (Button) findViewById(R.id.yanche_iknow_btn);
        yancheIknowBtn.setOnClickListener(this);
        yancheBeginbtn = (Button) findViewById(R.id.yanche_begin_btn);
        yancheBeginbtn.setOnClickListener(this);
        yancheTelBtn = (ImageButton) findViewById(R.id.yanche_tel_btn);
        yancheTelBtn.setOnClickListener(this);
        yancheAddBtn = (ImageButton) findViewById(R.id.yanche_add_btn);
        yancheAddBtn.setOnClickListener(this);
        yancheJianceBtn = (ImageButton) findViewById(R.id.yanche_order_jianche_btn);
        yancheJianceBtn.setOnClickListener(this);
        yancheCustomBack = (ImageButton) findViewById(R.id.yanche_custom_back);
        yancheCustomBack.setOnClickListener(this);
        yancheOwnerName = (TextView) findViewById(R.id.yanche_owner_name);
        yancheBeginType = (TextView) findViewById(R.id.yanche_order_begin_type);
        yancheBeginAdd = (TextView) findViewById(R.id.yanche_order_begin_add);
        yancheJianceAdd = (TextView) findViewById(R.id.yanche_order_jianche_add);
        yancheBeginTime = (TextView) findViewById(R.id.yanche_order_begin_time);
        yancheBeginMarked = (TextView) findViewById(R.id.yanche_order_begin_mark);
        builder = new YancheDialog.Builder(this);
        builder.setMessage("验车需要行驶本和身份证原件,请同用户确认");
        builder.setNegativeButton("联系用户", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.setPositiveButton("已确认", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.yanche_iknow_btn:

                break;
            case R.id.yanche_begin_btn:
                builder.create().show();
                break;
            case R.id.yanche_tel_btn:

                break;
            case R.id.yanche_add_btn:

                break;
            case R.id.yanche_order_jianche_btn:

                break;
            case R.id.yanche_custom_back:

                break;
            default:
                break;
        }
    }
}
